extends Button

@export var slot_index := 0

@onready var icon1 = $MarginContainer/ItemIcon

@onready var quantity_label = $QuantityLabel

func update_slot(item_data):
	if item_data:
		icon1.texture = item_data.texture
		quantity_label.text = str(item_data.quantity) if item_data.stackable else ""
		visible = true
	else:
		visible = false

func _on_pressed():
	Inventory.select_slot(slot_index)
